<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <div id="box">
    <p>----{{val}}----</p>
    键盘修饰符
    <br>
    <input @keyup.enter="keyup" type="text">
    <br>
    <input @keyup.t="keyup" type="text">
    <hr>
    v-model修饰符
    <br>
    <!--去除空格-->
    去除空格<input v-model.trim="val" type="text">
    <br>
    <!--转数字-->
    转数字<input v-model.number="val" type="text">
    <br>
    change事件
    <input v-model.lazy="val" type="text">
  </div>

  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>

  <script>


    new Vue({
      el: '#box',
      data: {
        val: ''
      },
      methods: {
        keyup () {
          console.log(11);
        }

      }
    })




  </script>

</body>

</html>